import request from '@/utils/request';

const API_URL = '/api/students';

/**
 * 分页查询学生信息
 *
 * @param {Object} params - 查询参数
 * @returns {Promise<AxiosResponse>}
 */
export function getStudents(params) {
  return request({
    url: API_URL+"/getPage",
    method: 'get',
    params: params
  });
}

/**
 * 获取单个学生详情
 *
 * @param {number} id - 学生ID
 * @returns {Promise<AxiosResponse>}
 */
export function getStudentById(id) {
  return request({
    url: `${API_URL}/${id}`,
    method: 'get'
  });
}

/**
 * 保存或更新学生信息
 *
 * @param {Object} student - 学生对象
 * @returns {Promise<AxiosResponse>}
 */
export function saveOrUpdateStudent(student) {
  return request({
    url: API_URL,
    method: 'post',
    data: student
  });
}

/**
 * 删除学生信息
 *
 * @param {number} id - 学生ID
 * @returns {Promise<AxiosResponse>}
 */
export function deleteStudent(id) {
  return request({
    url: `${API_URL}/${id}`,
    method: 'delete'
  });
}



